import java.sql.SQLException;
import java.util.Date;

import models.Client;
import models.Payment;
import models.Subscription;
import models.Workshop;
import models.Workshop.DagDeel;
import database.MySQLServer;
import database.SQLServer;
import databasetranslation.ClientList;
import databasetranslation.PaymentList;
import databasetranslation.SubscriptionList;
import databasetranslation.WorkshopList;


public class FillDatabaseSmall {
	@SuppressWarnings("deprecation")
	public static void main(String[] args) throws SQLException {
		SQLServer server = new MySQLServer("localhost","root","usbw");
	
		ClientList clients = new ClientList(server);
		clients.clearDatabaseTable();
		Client c1 = new Client("Bart", "Spencer", "Myroad 16, 28240 MyCity", "06 390 444 34", "markspancer@gmail.com");
		Client c2 = new Client("Achiel", "flap", "Myop 16, 28240 youCity", "06 974 367 34", "flipflap@gmail.com");
		Client c3 = new Client("Camiel", "flup", "Mioup 16, 2854 flapCity", "06 333 856 34", "camielflup@gmail.com");
		Client c4 = new Client("Kees", "Konijn", "drebbelweg 23, Delft", "06 390 224 34", "klant1@gmail.com");
		Client c5 = new Client("Klaas", "flap", "Een doos onder de Abwoudsebrug", "06 746 452 34", "klant2@gmail.com");
		
		clients.add(c1);clients.add(c2);clients.add(c3);clients.add(c4);clients.add(c5);
		
		WorkshopList workshops = new WorkshopList(server);
		workshops.clearDatabaseTable();
		Date now = new Date();
		Date future2 = new Date(111,02,07);
		Date future3 = new Date(111,02,18);
		Date future4 = new Date(111,02,19);
		
		DagDeel vm1 = DagDeel.VOORMIDDAG;
		DagDeel vm2 = DagDeel.NAMIDDAG;
		Workshop w1 = new Workshop("Alles maken", now, vm2, 10.0, "explanation1", 10, "docent1");
		Workshop w2 = new Workshop("Canon zingen", future2, vm1, 12.0, "explanation2", 2, "docent2");
		Workshop w3 = new Workshop("Poep scheppen", future2, vm1, 15.0, "explanation3", 10, "docent1");
		Workshop w4 = new Workshop("Hond uitlaten", future3, vm2, 32.0, "explanation4", 100, "docent2");
		Workshop w5 = new Workshop("Schilderen", future4, vm1, 10.0, "explanation5", 10, "docent1");

		workshops.add(w1);workshops.add(w2);workshops.add(w3);workshops.add(w4);workshops.add(w5);
		
		SubscriptionList subscriptions = new SubscriptionList(server, workshops, clients);
		subscriptions.clearDatabaseTable();
		subscriptions.add(new Subscription(c1,w1));
		subscriptions.add(new Subscription(c1,w2));
		subscriptions.add(new Subscription(c4,w5));
		subscriptions.add(new Subscription(c3,w5));
		subscriptions.add(new Subscription(c2,w5));

		
		PaymentList payments = new PaymentList(server, clients);
		payments.clearDatabaseTable();
		payments.add(new Payment(c1, 25, now, "I`ve made a comment."));
		payments.add(new Payment(c2, 100, now, "I`ve made no comment."));
		payments.add(new Payment(c3, 23, now, "I`ve made a comment."));
		payments.add(new Payment(c4, 150, now, "I`ve made no comment."));
	}
}
